package com.example.communist_app_api.service.impl;

import com.example.communist_app_api.db.dao.CartDao;
import com.example.communist_app_api.service.CartService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

@Transactional
@Service
public class CartServiceImpl implements CartService {

    @Autowired
    private CartDao cartDao;

    @Override
    public int getCartNum(Integer id) {

        int num = cartDao.getCartNum(id);
        return num;
    }

    @Override
    public int insertCartNum(Integer userId,Integer articleId) {
        int intNum = cartDao.insertCartNum(userId, articleId);
        return intNum;
    }

    @Override
    public int deleteCartNum(Integer userId,Integer articleId) {
        int deleteNum = cartDao.deleteCartNum(userId, articleId);
        return deleteNum;
    }

    @Override
    public Boolean judgmentCart(Integer userId, Integer id) {
        return cartDao.judgmentCart(userId, id);
    }
}
